/*
 * @Author: admin
 * @Date: 2022-02-26 09:30:48
 * @LastEditTime: 2022-02-26 09:30:48
 * @LastEditors: Please set LastEditors
 * @Description: 时间戳转换 --> 2022-02-26 09:30:48
 * @FilePath: src/utils/time.js
 */
class Time {
    // 1645839048000 --> 2022-02-26 09:30:48
    formatTime (current, isShow) {
      if (!current) {
        return
      }
      const date = new Date(current);
      const y = date.getFullYear();
      const m = (date.getMonth() + 1) < 10 ? `0${date.getMonth() + 1}` : date.getMonth() + 1;
      const d = date.getDate() < 10 ? `0${date.getDate()}` : date.getDate();
    //   const h = date.getHours() < 10 ? `0${date.getHours()}` : date.getHours();
    //   const mi = date.getMinutes() < 10 ? `0${date.getMinutes()}` : date.getMinutes();
    //   const s = date.getSeconds() < 10 ? `0${date.getSeconds()}` : date.getSeconds();
      if(isShow) {
        return `${y}${m}${d}`
      }
      return `${y}/${m}/${d}`;
    }
  }
  export default new Time();
  